﻿namespace Corporation.Project
{
    [Description(nameof(ProjectPack))]
    public class ProjectPack : AspPackBase
    {
        public override PackLevel Level => PackLevel.Module;

        public override int OrderNo => 0;

        /// <summary>
        /// 将模块服务添加到依赖注入服务容器中
        /// </summary>
        /// <param name="services">依赖注入服务容器</param>
        /// <returns></returns>
        public override IServiceCollection AddServices(IServiceCollection services)
        {
            services.AddSingleton<IMapTuple, AutoMapperConfiguration>();

            //Database


            //service
            services.AddScoped<IProjectContract, ProjectService>();

            return services;
        }

        /// <summary>
        /// 应用AspNetCore的服务业务
        /// </summary>
        /// <param name="app">Web应用程序</param>
        public override void UsePack(WebApplication app)
        {
            IServiceProvider provider = app.Services;

            base.UsePack(provider);
        }

    }
}
